import com.mysql.cj.jdbc.MysqlDataSource;

import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.ParameterMetaData;
import java.sql.PreparedStatement;
import java.sql.SQLException;

public class TestMain {
    public static void main(String[] args) throws SQLException, ClassNotFoundException {
        Class.forName("com.mysql.jdbc.Driver");
        MysqlDataSource dataSource = new MysqlDataSource();
        dataSource.setUrl("jdbc:mysql://127.0.0.1:3306/mytest?characterEncoding=UTF-8&&sueSSL=false");
        dataSource.setUser("root");
        dataSource.setPassword("666666");
        Connection connection = dataSource.getConnection();
        String s = "insert into student values(9,'12535','遇事问春风',5";
        PreparedStatement preparedStatement = connection.prepareStatement(s);
        int ret = preparedStatement.executeUpdate();
        System.out.println(ret);
        connection.close();
        preparedStatement.close();
    }

}
